package c.a.a.d0;

import android.graphics.Color;
import android.graphics.PointF;
import c.a.a.d0.h0.c;
import c.a.a.d0.h0.c.a;
import c.a.a.d0.h0.c.b;
import com.pgl.sys.ces.out.ISdkLite;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/* compiled from: JsonUtils */
public class o {
    public static final a a = a.a("x", "y");

    public static int a(c cVar) throws IOException {
        cVar.n();
        int w = (int) (cVar.w() * 255.0d);
        int w2 = (int) (cVar.w() * 255.0d);
        int w3 = (int) (cVar.w() * 255.0d);
        while (cVar.t()) {
            cVar.y0();
        }
        cVar.q();
        return Color.argb(ISdkLite.REGION_UNSET, w, w2, w3);
    }

    public static PointF b(c cVar, float f) throws IOException {
        int ordinal = cVar.u0().ordinal();
        float w;
        float w2;
        if (ordinal == 0) {
            cVar.n();
            w = (float) cVar.w();
            w2 = (float) cVar.w();
            while (cVar.u0() != b.END_ARRAY) {
                cVar.y0();
            }
            cVar.q();
            return new PointF(w * f, w2 * f);
        } else if (ordinal == 2) {
            cVar.o();
            w = 0.0f;
            w2 = 0.0f;
            while (cVar.t()) {
                int w0 = cVar.w0(a);
                if (w0 == 0) {
                    w = d(cVar);
                } else if (w0 != 1) {
                    cVar.x0();
                    cVar.y0();
                } else {
                    w2 = d(cVar);
                }
            }
            cVar.r();
            return new PointF(w * f, w2 * f);
        } else if (ordinal == 6) {
            w = (float) cVar.w();
            w2 = (float) cVar.w();
            while (cVar.t()) {
                cVar.y0();
            }
            return new PointF(w * f, w2 * f);
        } else {
            StringBuilder g = c.b.a.a.a.g("Unknown point starts with ");
            g.append(cVar.u0());
            throw new IllegalArgumentException(g.toString());
        }
    }

    public static List<PointF> c(c cVar, float f) throws IOException {
        ArrayList arrayList = new ArrayList();
        cVar.n();
        while (cVar.u0() == b.BEGIN_ARRAY) {
            cVar.n();
            arrayList.add(b(cVar, f));
            cVar.q();
        }
        cVar.q();
        return arrayList;
    }

    public static float d(c cVar) throws IOException {
        b u0 = cVar.u0();
        int ordinal = u0.ordinal();
        if (ordinal == 0) {
            cVar.n();
            float w = (float) cVar.w();
            while (cVar.t()) {
                cVar.y0();
            }
            cVar.q();
            return w;
        } else if (ordinal == 6) {
            return (float) cVar.w();
        } else {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("Unknown value for token of type ");
            stringBuilder.append(u0);
            throw new IllegalArgumentException(stringBuilder.toString());
        }
    }
}
